package cn.tedu.submarine;

import javax.swing.*;

/** 战舰 **/
public class Battleship extends SeaObject   {//战舰类
    private int life;    //命数
    public Battleship(){
        super(66,26,270,124,20);

        life=5;
    }

    @Override
    public void move() {
        //暂时搁置
    }


    public ImageIcon getImage(){
        return Images.battleship;//返回战舰图片
    }

    public Bomb shootBomb(){
        return new Bomb(this.x,this.y);
    }
    public void moveLeft() {
        if (x - speed >= 0) {
            x -= speed;
        } else {
            x = 0;
        }
    }
    public void moveRight(){
        if (x+speed+width<=World.WIDTH){
            x+=speed;
        }else{
            x=World.WIDTH-width;
        }
        ;}
    /** 战舰增命 */
    public void addLife(int num){
        life+=num;
    }

    public int getLife(){
        return life;
    }
    public void subtractLife(){life--;}


}


